<?php
/* @var $this AdController */
$this->layout = '//layouts/admin/ad';
$this->pageTitle = '广告';
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/js/ad.js', CClientScript::POS_END);
?>
<div class="container container-admin">
    <div class='row'>
        <div class="span3">
            <?php $this->beginWidget('AdminLeftNavWidget');$this->endWidget();?>
        </div>
        <div class='span9'>
            <div class='page-header' style='padding-bottom:0px'>
                <h2>
                    <span class='fui-new'></span>
                    广告
                    <small class='label'>
                        <a href='<?php echo Yii::app()->createUrl('admin/ad/create');?>'>
							添加
						</a>
                    </small>
                </h2>
            </div>
            <div class='page-header'>
                <input style='padding: 2px;' type='text' name='keyword' placeholder='输入搜索词'/>
                <select class='blog-date'>
                    <option>所有日期</option>
                    <option>1月</option>
                    <option>2月</option>
                </select>
                <select class='blog-category'>
                    <option>所有分类</option>
                    <option>PHP</option>
                    <option>JAVA</option>
                </select>
                <input type='submit' class='btn' style='padding: 3px 5px;margin-bottom: 10px;' value='筛选广告' />
            </div>
            <div class="table" style="min-height:300px">
                <table class='table table-bordered table-hover'>
                    <thead>
                        <tr>
                            <td>ID</td>
                            <td style='min-width: 300px'>标题</td>
                            <td>类型</td>
                            <td>时间日期</td>
                        </tr>
                    </thead>
                    <tbody>
                        <?php if($models):?>
                            <?php foreach($models as $k=>$v):?>
                            <tr>
                                <td><span class="badge"><?php echo $v->id;?></span></td>
                                <td>
                                	<div>
                                		<?php echo HelperString::sysSubStr($v->ad_title,30, true);?>
                                	</div>
                                	<div class='control'>
                                		<input type="hidden" value="<?php echo $v->id;?>" name="ad-id">
	                            		<a href='<?php echo Yii::app()->createUrl('admin/ad/update',array('id'=>$v->id));?>' class="btn btn-primary btn-small btn-control">编辑</a>
	                            		<a id="ad-lock" href='<?php echo Yii::app()->createUrl('admin/ad/lock',array('id'=>$v->id));?>' class="btn <?php echo $v->is_lock ? '' : 'btn-primary';?> btn-small btn-control">锁定</a>
	                            		<a id="ad-delete" href='<?php echo Yii::app()->createUrl('admin/ad/delete',array('id'=>$v->id));?>' class="btn <?php echo $v->is_delete ? '' : 'btn-primary';?> btn-small btn-control">删除</a>
	                            	</div>
                                </td>
                                <td><?php echo $v->type->screen_name;?></td>
                                <td><?php echo $v->update_date;?></td>
                            </tr>
                            <?php endforeach;?>
                        <?php endif;?>
                    </tbody>
                </table>
            </div>
            <div class="pagination">
                <?php 
                $this->widget('CLinkPager', array(
                    'pages' => $pages,
                    'cssFile'=>'',
                    'firstPageCssClass'=>'hidden',
                    'firstPageLabel'=>'',
                    'internalPageCssClass'=>'',
                    'lastPageCssClass'=>'hidden',
                    'lastPageLabel'=>'',
                    'previousPageCssClass'=>'previous',
                    'prevPageLabel'=>'',
                    'nextPageLabel'=>'',
                    'selectedPageCssClass'=>'active',
                    'hiddenPageCssClass'=>'',
                    'header'=>'',
                    'htmlOptions'=>array(
                        'class'=>''
                        )
                    )); 
                ?>
            </div>
        </div>
    </div>
</div>